<template>
  <van-nav-bar
    title="用户中心"
    left-text="返回"
    right-text="退出"
    left-arrow
    @click-left="$router.back()"
    @click-right="userQuite"
  />

  <van-cell-group title="个人中心" inset>
    <van-cell title="修改密码" is-link to="changepass" />
    <van-cell title="订单中心" is-link to="order"></van-cell>
    <van-cell title="地址管理" is-link to="address"></van-cell>
  </van-cell-group>
</template>

<script setup lang="ts">
import {ref} from "vue"
import { useUserInfoStore } from "@/stores/userInfo";
import {useRouter} from "vue-router"
import { showSuccessToast } from "vant";



const router = useRouter()
const store = useUserInfoStore()
const userQuite = ()=>{
  // 1.清除store中的数据
  store.setUserData({});
  // 2.清除localstorage中的数据
  localStorage.setItem("userData", "{}");
  showSuccessToast("退出成功");
  router.replace("/index");
}
</script>

<style></style>
